<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>卡拉卡-在线选号平台</title>
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<link href="css/win.css" rel="stylesheet" type="text/css" />
		<link href="css/pagination.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../js/jquery-1.7.min.js"></script>
		<script type="text/javascript" src="../js/jquery.pagination.js"></script>
		<script type="text/javascript" src="../js/jquery.cookie.js"></script>
		<script type="text/javascript" src="../js/logon.js"></script>
		<script type="text/javascript" src="../js/jquery.blockUI.js"></script>
		<script type="text/javascript" src="../js/datepicker/WdatePicker.js"></script>
		<script language="javascript" type="text/javascript">
			var page = 0; //页面索引初始值
			var pageSize = 9; //每页显示条数初始化，修改显示条数，修改这里即可
			$(function () {
				//initTable(10); //Load事件，初始化表格数据，页面索引为0（第一页）
				//分页，PageCount是总条目数，这是必选参数，其它参数都是可选
				$("#Pagination").pagination($!{model.get("count")}, {
					callback:PageCallback, //PageCallback() 为翻页调用次函数。
					prev_text:"上一页",
					next_text:"下一页",
					items_per_page:pageSize,
					num_edge_entries:2, //两侧首尾分页条目数
					num_display_entries:3, //连续分页主体部分分页条目数
					current_page:page, //当前页索引
				});
				//翻页调用
				function PageCallback(page,jq) {
					initTable(page);
				}
				//请求数据
				function initTable(page) {
					$.ajax({
						type:"POST",
						dataType:"text",
						url:"/log/page", //提交到一般处理程序请求数据
						data:{page:page+1,pageSize:pageSize,type:'$!{model.get("type")}',severity:'$!{model.get("severity")}',st:'$!{model.get("st")}',et:'$!{model.get("et")}',keyword:'$!{model.get("keyword")}'}, //提交两个参数：pageIndex(页面索引)，pageSize(显示条数)
						success:function(data){
						//alert(data);
							$('#list-content').html('');
							$('#list-content').html(data);
						}
					});
				}
			});
			
			function search()
			{
				$("#searchForm").submit();
			}
			$(document).ready(function() {
			    $('#btn_import').click(function() {
			        $.blockUI({ message: $('#importPop'),
			        title:    'This is your title',
			        });
			        
			    });
			});
			
			//时间类型切换
			function doChange(obj)
			{
				$.ajax({    
			        type:'post',
			        url:'/common/datetype',
			        data:{dateType:obj.value},
			        cache:false,
			        async:false,
			        dataType:'json',
			        success:function(data){
			        	var d = jQuery.parseJSON(data);
			        	$("#st").val(data.st);
			        	$("#et").val(data.et);
			        },
			        error: function(){  //失败
				        alert('Error loading document');
				    }
			    });  
			}
		</script>
	</head>

	<body>
		#include("header.html")
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="content">
			<tr><td valign="top" id="menu">
			#include("menu_admin.html")
			</td>
			<td id="right">
				<div id="order">
					<form id="searchForm" name="searchForm" action="/log" method="post">
					<div class="title">
						<span>首页 &gt; 日志管理</span>
					</div>
					<div class="step">
						类型：
						<select name="type">
							<option value="-1">全部</option>
							<option value="1" #if($!{model.get("type")}==1) selected #end>操作日志</option>
							<option value="2" #if($!{model.get("type")}==2) selected #end>运行日志</option>
							<option value="3" #if($!{model.get("type")}==3) selected #end>用户日志</option>
							<option value="4" #if($!{model.get("type")}==4) selected #end>安全日志</option>
						</select>
						级别：
						<select name="severity">
							<option value="-1">全部</option>
							<option value="1" #if($!{model.get("severity")}==1) selected #end>信息</option>
							<option value="2" #if($!{model.get("severity")}==2) selected #end>警告</option>
							<option value="3" #if($!{model.get("severity")}==3) selected #end>错误</option>
						</select>
						<select name="dateType" onChange="doChange(this);">
						  <option value="today" #if($!{model.get("dateType")}=="today") selected #end>今天</option>
						  <option value="yestday" #if($!{model.get("dateType")}=="yestday") selected #end>昨天</option>
						  <option value="week" #if($!{model.get("dateType")}=="week") selected #end>本周</option>
						  <option value="oneWeek" #if($!{model.get("dateType")}=="oneWeek") selected #end>一周内</option>
						  <option value="month" #if($!{model.get("dateType")}=="month") selected #end>本月</option>
						  <option value="oneMonth" #if($!{model.get("dateType")}=="oneMonth") selected #end>一月内</option>
						  <option value="period" #if($!{model.get("dateType")}=="period") selected #end>时间段</option>
						</select>
						<input type="text" id="st" name="st" value="$!{model.get("st")}" class="Wdate" style="height:20px" onfocus="WdatePicker();"/>-
						<input type="text" id="et" name="et" value="$!{model.get("et")}" class="Wdate" style="height:20px" onfocus="WdatePicker();"/>
						关键字：
						<input type="text" name="keyword" class="sou_input" value="$!{model.get("keyword")}"/>
						<input type="button" name="Submit" value="查询" class="out_btn" onclick="search();" />
					</div>
					</form>
				</div>
				<div id="list">
					<div class="title" style="font-size:13px;font-weight:600;display:none">
						<span>查询结果</span>
					</div>
					<div class="data">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<thead>
							<tr>
								<td width="120">日志时间</td>
								<td>客户端IP</td>
								<td>日志类型</td>
								<td>日志级别</td>
								<td>日志内容</td>
							</tr>
							</thead>
							<tbody id="list-content">
							</tbody>
							<tr>
								<td colspan="5">
									<table width="100%" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td><div id="Pagination" class="pagination" style="margin:4px 0 0 0"></div></td>
											<td width="80">共$!{model.get("count")}条</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</div>
				</div>
				</td></tr></table>
		#include("footer.html")
	</body>
</html>
